import socket

# 配置参数
LOCAL_HOST = '127.0.0.1'
PORT = 5000
BUFFER_SIZE = 4096

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
    MESSAGE = input(">> ")
    s.sendto(MESSAGE.encode(), (LOCAL_HOST, PORT))

    data, addr = s.recvfrom(BUFFER_SIZE)